package com.baidu1;

public class RunnableTest implements Runnable{
	public String name;
	public RunnableTest(String name){
		this.name=name;
	}
	public void run(){
		for(int i=0;i<10;i++){
			System.out.println(i+""+name);
			try{
				Thread.currentThread().sleep((int)(Math.random()*1000));
			}catch(InterruptedException e){}
		}
		System.out.println("Finished!"+name);
	}
	public static void main(String args[]) throws InterruptedException{
		RunnableTest r1 = new RunnableTest("First");
		RunnableTest r2 = new RunnableTest("Second");
		Thread t1 = new Thread(r1);
		Thread t2 = new Thread(r2);
		t1.start();
		t2.start();
	}
}
